TARGET = ../main_device

#CROSS = arm-linux-gnueabihf-
CC  = $(CROSS)gcc
AR  = $(CROSS)ar

CFLAGS += -Wall  -O3 -I../
VERBOSE = @
COMPILE = $(VERBOSE) $(CC) $(CFLAGS)  -c
LINK = $(VERBOSE) $(CC) -lpthread -ldl

SOURCES = $(wildcard *.c wildcard ../*.c)
OBJFILES = $(SOURCES:%.c=%.o)

LIBJSON = $(LIBJSON_DIR)/libjson.a

all:	$(TARGET)

$(TARGET):	$(OBJFILES) 
	@echo
	@echo Linking $@ from $^ 
	$(LINK) -o $@ $^ -lpthread


$(OBJFILES):	%.o: %.c 
	@echo Compiling $@ from $<
	$(COMPILE) -o $@ $<


clean:
	@echo Removing generated files..
	$(VERBOSE) -$(RM) -rf $(OBJFILES) $(TARGET) *~ *.d .dep
